package com.alibaba.aone.casestudy.common.entity;

import java.io.Serializable;


public class OptionBean implements Serializable, Comparable<OptionBean> {

    /**
     * Serial Version UID
     */
    private static final long serialVersionUID = -7441737588914736211L;

    /**
     * Option id
     */
    private String value;

    /**
     * Option value
     */
    private String name;

    public OptionBean() {

    }

    /**
     * Constructor.
     */
    public OptionBean(String value, String name) {
        this.value = value;
        this.name = name;
    }

    /**
     * @return the id
     */
    public String getValue() {
        return value;
    }

    /**
     * @param value
     *            the id to set
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name
     *            the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    public int compareTo(OptionBean o) {
        return this.getValue().compareTo(o.getValue());
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((value == null) ? 0 : value.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof OptionBean)) {
            return false;
        }
        OptionBean option = (OptionBean) o;
        return ((this.getValue().equalsIgnoreCase(option.getValue()))&&(this.getName().equalsIgnoreCase(option.getName())));

    }

}
